class NativeCallJS {
  #chooseFileCallback
  #goBackCallback
  constructor() {
    this.init()
  }
  init() {
    window.nativetojs_chooseFileComplete = this.chooseFileComplete.bind(this)
    window.nativetojs_goBack = this.nativegoBack.bind(this)
  }

  chooseFileComplete(fileInfos) {
    this.#chooseFileCallback(fileInfos)
  }
  registerChooseFileComplete(callbackMethod) {
    this.#chooseFileCallback = callbackMethod
  }

  nativegoBack() {
    this.#goBackCallback()
  }
  registerNativieGoBack(callbackMethod) {
    this.#goBackCallback = callbackMethod
  }

  callBackNative(methodName, result) {
    window.kingoapp.callBackNative(methodName, result)
  }
}
export default NativeCallJS
